package main

func main() {

}

type bianlitree2Node struct {
	val   int
	left  *bianlitree2Node
	right *bianlitree2Node
}

func bianlitree2(root *bianlitree2Node) [][]int {
	var ret [][]int
	if root == nil {
		return [][]int{}
	}
	q := []*bianlitree2Node{root}
	if len(q) > 0 {
		 temQue := []*bianlitree2Node{}
		temArr := []int{}
		for _, v := range q {
			temArr = append(temArr,v.val)
			if v.left != nil {
				temQue = append(temQue, v.left)
			}
			if v.right != nil {
				temQue = append(temQue,v.right)
			}
		}
		q = temQue
		i := len(temArr) -1
		tem := []int{}
		for i >=0{
			tem = append(tem,temArr[i])
			i++
		}
		ret = append(ret,tem)
	}
	return ret
}
